<!DOCTYPE html>
<html lang="en">
  <head>
    <meta http-equiv="content-type" content="text/html; charset=utf-8">
    <title>OpenTBS Demo</title>
    <script>
  // redirection if open without the menu at the TBS site
  if ( (document.location.href.indexOf('www.tinybutstrong.com') > 0)
        && (document.location.href.indexOf('demo.html') > 0)
	  ) {
  	document.location.href = "/opentbs.php?demo";
  }
</script>
    <script>
	function download_template() {
		var file = document.forms['form1'].elements['tpl'].value;
		var rep = document.forms['form1'].action;
		var p = rep.lastIndexOf('/');
		if (p>=0) {
			file = rep.substr(0, p+1) + file
		}
		window.location.href = file;
	}
</script>
    <style>
<!--
body,td,th {
	font-family: Verdana, Geneva, sans-serif;
	font-size: 11px;
}
.line {
	margin-top: 4px;
}
-->
</style>
  </head>
  <body>
    <!-- main-body is used for insertion in the TBS menu -->
    <div id="main-body">
      <div style="text-align: center;">
        <h1>OpenTBS demo</h1>
        <p> OpenTBS is a PHP tool that produces any OpenOffice and Ms Office
          documents with the technic of template
        </p>
      </div>
      <h2>Presentation</h2>
      <p>OpenTBS can merge any OpenDocument and Open XML files. It
        autommatically reconize extensions: <strong>odt</strong>, <strong>ods</strong>,
        <strong>odg</strong>, <strong>odf</strong>, <strong>odm</strong>, <strong>odp</strong>,
        <strong>ott</strong>, <strong>ots</strong>, <strong>otg</strong>, <strong>otp</strong>,
        <strong>docx</strong>, <strong>xlsx, xlsm</strong>, <strong>pptx</strong>.</p>
      <p> In fact it can merge any XML or Text file saved in a zip container
        (which is the case for both OpenDocuments and OpenXML documents).</p>
      <p>In addition to the usual merging operations, many other oprerations can
        be done on documents, such as: feed a table, delete or display
        paragraphs, change pictures, delete sheets, change data in graphs, ...
        and much more.</p>
      <p>Since version 1.10.0, OpenTBS can also read data in workbooks (<strong>xlsx</strong>
        and <strong>ods</strong> files).</p>
      <h2>Characteristics</h2>
      <ul>
        <li> No temporary files needed.</li>
        <li> Creates a new document directly as a download, a physical file, or
          a binary PHP string.</li>
        <li> Works with PHP 8, PHP 7 and PHP 5.</li>
        <li> No PHP extension required (but easier to use if <a href="http://www.php.net/manual/en/book.zlib.php">ZLib</a>
          is enabled)</li>
      </ul>
      <h2>Merging Demo</h2>
      <!-- classes are compliant with Bootstrap -->
      <form id="form1" method="post" action="./demo_merge.php">
        <table style="border: 0px;">
          <tbody>
            <tr>
              <td>Enter a name : </td>
              <td> <input class="form-control line" name="yourname" size="10" type="text">
                <i>(will be displayed in the merged result)</i> </td>
            </tr>
            <tr>
              <td>Choose a template : </td>
              <td>
                <select name="tpl" class="form-control line">
                  <option value="demo_oo_text.odt">OpenOffice Writer Document
                    (.odt)</option>
                  <option value="demo_oo_spreadsheet.ods">OpenOffice Calc
                    Spreadsheet (.ods)</option>
                  <option value="demo_oo_presentation.odp">OpenOffice Impress
                    Presentation (.odp)</option>
                  <option value="demo_oo_graph.odg">OpenOffice Draw Graphic
                    (.odg)</option>
                  <option value="demo_oo_formula.odf">OpenOffice Math Formula
                    (.odf)</option>
                  <option value="demo_ms_word.docx">Ms Word Document (.docx)</option>
                  <option value="demo_ms_excel.xlsx">Ms Excel SpreadSheet
                    (.xlsx)</option>
                  <option value="demo_ms_powerpoint.pptx">Ms PowerPoint
                    Presentation (.pptx)</option>
                </select>
              </td>
            </tr>
            <tr>
              <td>Debug : </td>
              <td>
                <select name="debug" class="form-control line">
                  <option value="" selected="selected">No</option>
                  <option value="info">General Information</option>
                  <option value="current">During merge</option>
                  <option value="show">After merge</option>
                </select>
              </td>
            </tr>
            <tr id="save_as_file" style="display:none;">
              <td>Save locally with suffix : </td>
              <td><input name="save_as" class="form-control line" size="10" type="text">
                <i>(leave empty for direct download)</i></td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td> <input name="btn_result" class="btn btn-primary line" value="Merge"
type="submit"> <input name="btn_template" class="btn btn-info line" value="See template"
type="submit"> <input name="btn_script" class="btn btn-secondary line" value="See PHP script"
type="submit"> </td>
            </tr>
          </tbody>
        </table>
      </form>
      <h2>Reading Demo</h2>
      <form id="form2" method="post" action="./demo_read.php">
        <table style="border: 0px;">
          <tbody>
            <tr>
              <td>Choose a file : </td>
              <td>
                <select name="file" class="form-control line">
                  <option value="demo_read_oo_spreadsheet.ods">OpenOffice Calc
                    Spreadsheet (.ods)</option>
                  <option value="demo_read_ms_excel.xlsx">Ms Excel SpreadSheet
                    (.xlsx)</option>
                </select>
              </td>
            </tr>
            <tr>
              <td>Debug : </td>
              <td>
                <select name="debug" class="form-control line">
                  <option value="" selected="selected">No</option>
                  <option value="info">General Information</option>
                  <option value="current">During merge</option>
                  <option value="show">After merge</option>
                </select>
              </td>
            </tr>
            <tr>
              <td>&nbsp;</td>
              <td> <input name="btn_result" class="btn btn-primary line" value="Read"
type="submit"> <input name="btn_template" class="btn btn-info line" value="See template"
type="submit"> <input name="btn_script" class="btn btn-secondary line" value="See PHP script"
type="submit"> </td>
            </tr>
          </tbody>
        </table>
      </form>
      <h2>More</h2>
      <ul>
        <li> OpenTBS help file : <a href="http://www.tinybutstrong.com/plugins/opentbs/tbs_plugin_opentbs.html">tbs_plugin_opentbs.html</a></li>
        <li> Discover the <a href="http://www.tinybutstrong.com">TinyButStrong</a>
          template engine for PHP</li>
        <li> Go to <a href="http://www.tinybutstrong.com/plugins.php">OpenTBS
            download</a> page </li>
      </ul>
    </div>
    <script>
	// enable the option for savegin as a file, the PHP script will test if it is running on localhost anyway.
	if (window.location.hostname=='localhost') document.getElementById('save_as_file').style.display='table-row';
</script>
  </body>
</html>
